<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script src="../00.插件/babel.min.js"></script>
  <script src="../00.插件/react.development.js"></script>
  <script src="../00.插件/react-dom.development.js"></script>
</head>

<body>

<div id="app"></div>

<script type="text/babel">

  class Parent extends React.Component{

    render(){

      return(
        <div>
          姓名：<input type="text" ref={c => this.name = c }/>
          年龄：<input type="text" ref = {c => this.age = c} />
          爱好：<input type="text" ref={c => this.hobby = c} />
          <button onClick={this.handler}>点击获取数据</button>
        </div>
      )

    }
    handler = () =>{
      const name = this.name.value
      const age = this.age.value
      const hobby = this.hobby.value

      console.log(name,age,hobby)
    }

  }

  const root = ReactDOM.createRoot(document.getElementById('app')).render(<Parent/>)
</script>
</body>
</html>